package com.polarrose.spring.remoting.rest.utils;

import com.polarrose.spring.remoting.rest.annotations.RestService;

public class RestServiceUtils
{
    private RestServiceUtils()
    {
    }

    public static String getPathFromRestServiceClass(Class<? extends Object> clazz)
    {
        String path = null;

        RestService restServiceAnnotation = clazz.getAnnotation(RestService.class);
        if (restServiceAnnotation != null) {
            path = restServiceAnnotation.path();
            if (path.length() == 0) {
                path = "/" + clazz.getSimpleName();
            }
        }

        return path;
    }
}
